home *** CD-ROM | disk | FTP | other *** search
/ Giga Games 1 / Giga Games.iso / net / usenet / volume11 / reve / patch1c < prev    next >
Encoding:
Internet Message Format  |  1990-12-11  |  50.9 KB

  1. Path: uunet!ogicse!zephyr.ens.tek.com!tekred!saab!billr
  2. From: billr@saab.CNA.TEK.COM (Bill Randle)
  3. Newsgroups: comp.sources.games
  4. Subject: v11i063:  reve - an othello game, Patch1c
  5. Message-ID: <6567@tekred.CNA.TEK.COM>
  6. Date: 16 Nov 90 18:55:21 GMT
  7. Sender: news@tekred.CNA.TEK.COM
  8. Lines: 1592
  9. Approved: billr@saab.CNA.TEK.COM
  10. Posted: Fri Nov 16 10:55:21 1990
  11.  
  12. Submitted-by: Rich Burridge <rburridge@sun.COM>
  13. Posting-number: Volume 11, Issue 63
  14. Archive-name: reve/Patch1c
  15. Patch-To: reve: Volume 11, Issue 52-58
  16. Environment: SunView, XView, X11R4, termcap
  17.  
  18.  
  19.  
  20. #! /bin/sh
  21. # This is a shell archive.  Remove anything before this line, then unpack
  22. # it by saving it into a file and typing "sh file".  To overwrite existing
  23. # files, type "sh file -c".  You can also feed this as standard input via
  24. # unshar, or by typing "sh <file", e.g..  If this archive is complete, you
  25. # will see the following message at the end:
  26. #        "End of archive 3 (of 4)."
  27. # Contents:  patches01c
  28. # Wrapped by billr@saab on Fri Nov 16 10:46:44 1990
  29. PATH=/bin:/usr/bin:/usr/ucb ; export PATH
  30. if test -f 'patches01c' -a "${1}" != "-c" ; then 
  31.   echo shar: Will not clobber existing file \"'patches01c'\"
  32. else
  33. echo shar: Extracting \"'patches01c'\" \(48717 characters\)
  34. sed "s/^X//" >'patches01c' <<'END_OF_FILE'
  35. X
  36. X------- rev_eval.c -------
  37. X*** /tmp/da28908    Fri Nov  9 10:39:56 1990
  38. X--- rev_eval.c    Mon Nov  5 09:06:42 1990
  39. X***************
  40. X*** 3,13 ****
  41. X   *
  42. X   *  Copyright (C) 1990 - Yves Gallot - all rights reserved.
  43. X   *
  44. X!  *  Permission is given to distribute these sources, as long as the
  45. X!  *  introductory messages are not removed, and no monies are exchanged.
  46. X   *
  47. X!  *  You are forbidden from using Reve as is, or in a modified state, in
  48. X!  *  any tournaments, without the permission of the authors.
  49. X   *
  50. X   *  No responsibility is taken for any errors on inaccuracies inherent
  51. X   *  either to the comments or the code of this program, but if reported
  52. X--- 3,18 ----
  53. X   *
  54. X   *  Copyright (C) 1990 - Yves Gallot - all rights reserved.
  55. X   *
  56. X!  *  Permission is granted to copy this source, for redistribution
  57. X!  *  in source form only, provided the news headers in "substantially
  58. X!  *  unaltered format" are retained, the introductory messages are not
  59. X!  *  removed, and no monies are exchanged.
  60. X   *
  61. X!  *  Permission is also granted to copy this source, without the
  62. X!  *  news headers, for the purposes of making an executable copy by
  63. X!  *  means of compilation, provided that such copy will not be used
  64. X!  *  for the purposes of competition in any othello tournaments, without
  65. X!  *  prior permission from the authors.
  66. X   *
  67. X   *  No responsibility is taken for any errors on inaccuracies inherent
  68. X   *  either to the comments or the code of this program, but if reported
  69. X***************
  70. X*** 23,36 ****
  71. X  extern long c1, c2, c3 ;
  72. X  extern long edges[6561] ;
  73. X  
  74. X! /*  Evaluation function : give a note to a board = damier[ niv ].
  75. X   *  It computes 4 components :
  76. X   *     - Edge Stability, using Edge Stability Table pre-computed before
  77. X   *     - Current Mobility, in fact computed during alpha-beta pruning
  78. X   *     - X squares Values
  79. X   *     - Potential Mobility, looking at squares contacts
  80. X!  *  And then Eval = c1 * ES + c2 * CM + c3 * XV + c4 * PM
  81. X!  *  Eval is replaced by - Eval if Black is replaced by White. Eval is positif
  82. X   *  if macouleur ( my color ) has a good position and negatif if tacouleur
  83. X   *  position is good.
  84. X   *  If we are "near" the end of the game, then Eval is equal to final disc
  85. X--- 28,41 ----
  86. X  extern long c1, c2, c3 ;
  87. X  extern long edges[6561] ;
  88. X  
  89. X! /*  Evaluation function : gives a note to a board = damier[ niv ].
  90. X   *  It computes 4 components :
  91. X   *     - Edge Stability, using Edge Stability Table pre-computed before
  92. X   *     - Current Mobility, in fact computed during alpha-beta pruning
  93. X   *     - X squares Values
  94. X   *     - Potential Mobility, looking at squares contacts
  95. X!  *  And then Eval = c1 * ES + c2 * ( CM + cx * XV ) + c3 * PM
  96. X!  *  Eval is replaced by - Eval if Black is replaced by White. Eval is positive
  97. X   *  if macouleur ( my color ) has a good position and negatif if tacouleur
  98. X   *  position is good.
  99. X   *  If we are "near" the end of the game, then Eval is equal to final disc
  100. X***************
  101. X*** 45,51 ****
  102. X    register int i, x, y ;
  103. X    register long note ;
  104. X    register int vp, vo ;
  105. X!   register long tnote ;
  106. X  
  107. X    d = damier[niv] ;
  108. X  
  109. X--- 50,56 ----
  110. X    register int i, x, y ;
  111. X    register long note ;
  112. X    register int vp, vo ;
  113. X!   register long tnote, cx ;
  114. X  
  115. X    d = damier[niv] ;
  116. X  
  117. X***************
  118. X*** 105,135 ****
  119. X          }
  120. X        note += edges[i] ;
  121. X  
  122. X        if (d[0] == FREE)
  123. X          {
  124. X!                if (d[9] == macouleur) note -= c3 ;
  125. X!           else if (d[9] == tacouleur) note += c3 ;
  126. X          }
  127. X  
  128. X        if (d[7] == FREE)
  129. X          {
  130. X!                if (d[14] == macouleur) note -= c3 ;
  131. X!           else if (d[14] == tacouleur) note += c3 ;
  132. X          }
  133. X  
  134. X        if (d[56] == FREE)
  135. X          {
  136. X!                if (d[49] == macouleur) note -= c3 ;
  137. X!           else if (d[49] == tacouleur) note += c3 ;
  138. X          }
  139. X  
  140. X        if (d[63] == FREE)
  141. X          {
  142. X!                if (d[54] == macouleur) note -= c3 ;
  143. X!           else if (d[54] == tacouleur) note += c3 ;
  144. X          }
  145. X  
  146. X!       tnote = c1 * note + c2 * (vp0 - vo0) / (vp0 + vo0 + 2) ;
  147. X  
  148. X        vp = vo = 0 ;
  149. X        for (x = 0; x < 8; x++)
  150. X--- 110,142 ----
  151. X          }
  152. X        note += edges[i] ;
  153. X  
  154. X+       cx = 8 * (50 - mnb - profmax) ;
  155. X+ 
  156. X        if (d[0] == FREE)
  157. X          {
  158. X!                if (d[9] == macouleur) note -= cx ;
  159. X!           else if (d[9] == tacouleur) note += cx ;
  160. X          }
  161. X  
  162. X        if (d[7] == FREE)
  163. X          {
  164. X!                if (d[14] == macouleur) note -= cx ;
  165. X!           else if (d[14] == tacouleur) note += cx ;
  166. X          }
  167. X  
  168. X        if (d[56] == FREE)
  169. X          {
  170. X!                if (d[49] == macouleur) note -= cx ;
  171. X!           else if (d[49] == tacouleur) note += cx ;
  172. X          }
  173. X  
  174. X        if (d[63] == FREE)
  175. X          {
  176. X!                if (d[54] == macouleur) note -= cx ;
  177. X!           else if (d[54] == tacouleur) note += cx ;
  178. X          }
  179. X  
  180. X!       tnote = c1 * note + c2 * (long) 1000 * (vp0 - vo0) / (vp0 + vo0 + 2) ;
  181. X  
  182. X        vp = vo = 0 ;
  183. X        for (x = 0; x < 8; x++)
  184. X***************
  185. X*** 219,225 ****
  186. X            }
  187. X  
  188. X        note += ((long) 1000 * (vp - vo)) / (vp + vo + 2) ;
  189. X!       tnote += 99 * note ;
  190. X!       return(tnote) ;
  191. X      }
  192. X  }
  193. X--- 226,232 ----
  194. X            }
  195. X  
  196. X        note += ((long) 1000 * (vp - vo)) / (vp + vo + 2) ;
  197. X!       tnote += c3 * note ;
  198. X!       return(tnote / 1000) ;
  199. X      }
  200. X  }
  201. X
  202. X------- rev_ip.c -------
  203. X*** /tmp/da28911    Fri Nov  9 10:39:56 1990
  204. X--- rev_ip.c    Mon Nov  5 09:07:12 1990
  205. X***************
  206. X*** 3,11 ****
  207. X   *
  208. X   *  Copyright (C) 1990 - Yves Gallot - all rights reserved.
  209. X   *
  210. X!  *  Permission is given to distribute these sources, as long as the
  211. X!  *  introductory messages are not removed, and no monies are exchanged.
  212. X   *
  213. X   *  No responsibility is taken for any errors on inaccuracies inherent
  214. X   *  either to the comments or the code of this program, but if reported
  215. X   *  (see README file), then an attempt will be made to fix them.
  216. X--- 3,19 ----
  217. X   *
  218. X   *  Copyright (C) 1990 - Yves Gallot - all rights reserved.
  219. X   *
  220. X!  *  Permission is granted to copy this source, for redistribution
  221. X!  *  in source form only, provided the news headers in "substantially
  222. X!  *  unaltered format" are retained, the introductory messages are not
  223. X!  *  removed, and no monies are exchanged.
  224. X   *
  225. X+  *  Permission is also granted to copy this source, without the
  226. X+  *  news headers, for the purposes of making an executable copy by
  227. X+  *  means of compilation, provided that such copy will not be used
  228. X+  *  for the purposes of competition in any othello tournaments, without
  229. X+  *  prior permission from the authors.
  230. X+  *
  231. X   *  No responsibility is taken for any errors on inaccuracies inherent
  232. X   *  either to the comments or the code of this program, but if reported
  233. X   *  (see README file), then an attempt will be made to fix them.
  234. X***************
  235. X*** 12,22 ****
  236. X   */
  237. X  
  238. X  #include <stdio.h>
  239. X  #include <sys/types.h>
  240. X  #include <sys/time.h>
  241. X  #include "reve.h"
  242. X  
  243. X! extern time_t time() ;
  244. X  extern int damier[NIVEAUMAX][64] ;
  245. X  extern int tacouleur, macouleur ;
  246. X  extern int mnb, profmax ;
  247. X--- 20,33 ----
  248. X   */
  249. X  
  250. X  #include <stdio.h>
  251. X+ #include <signal.h>
  252. X+ #include <setjmp.h>
  253. X  #include <sys/types.h>
  254. X  #include <sys/time.h>
  255. X  #include "reve.h"
  256. X  
  257. X! extern int saveres ;
  258. X! extern time_t timeleft, time() ;
  259. X  extern int damier[NIVEAUMAX][64] ;
  260. X  extern int tacouleur, macouleur ;
  261. X  extern int mnb, profmax ;
  262. X***************
  263. X*** 58,81 ****
  264. X  
  265. X  static int timevals[MAXDIFF] = { 0, 1, 3, 5, 10, 15, 20, 30, 60 } ;
  266. X  
  267. X! static int cpi[60], cpj[60], cpk[60] ;
  268. X  
  269. X  static int locallevel = -1 ;
  270. X! static time_t timeleft ;
  271. X  
  272. X  static long jeplonge() ;
  273. X  static long tuplonges() ;
  274. X  long evalue() ;
  275. X  
  276. X  play_reve(board, color, level, rtnmv, rtnnote)
  277. X  int *board, color, level, *rtnmv ;
  278. X  long *rtnnote ;
  279. X  {
  280. X    register int *d0, *d1 ;
  281. X!   register int k, cp, cpmax ;
  282. X!   register long lnote, note ;
  283. X!   register int count, fact ;
  284. X!   time_t firsttime, timeused, allotime ;
  285. X  
  286. X    for (k = 0; k < 60; k++)
  287. X      {
  288. X--- 69,105 ----
  289. X  
  290. X  static int timevals[MAXDIFF] = { 0, 1, 3, 5, 10, 15, 20, 30, 60 } ;
  291. X  
  292. X! static int cpi[60], cpj[60], cpk[60], cpf[60] ;
  293. X! static int cpi2[60], cpj2[60], cpk2[60] ;
  294. X! static int cpmaxi[4] ;
  295. X  
  296. X  static int locallevel = -1 ;
  297. X! static firsttime, timeused, allotime ;
  298. X  
  299. X+ jmp_buf jumper ;
  300. X+ 
  301. X  static long jeplonge() ;
  302. X  static long tuplonges() ;
  303. X  long evalue() ;
  304. X  
  305. X+ 
  306. X+ static void
  307. X+ catcher()
  308. X+ {
  309. X+   longjmp(jumper, 1) ;
  310. X+ }
  311. X+ 
  312. X+ 
  313. X  play_reve(board, color, level, rtnmv, rtnnote)
  314. X  int *board, color, level, *rtnmv ;
  315. X  long *rtnnote ;
  316. X  {
  317. X    register int *d0, *d1 ;
  318. X!   register int k, cp ;
  319. X!   register long lnote ;
  320. X!   register int count ;
  321. X!   static int cpmax, note, oldnote ;
  322. X!   FILE *fp ;
  323. X  
  324. X    for (k = 0; k < 60; k++)
  325. X      {
  326. X***************
  327. X*** 119,125 ****
  328. X            mnb++ ;
  329. X            cp = 0 ;
  330. X            while (cpk[cp] != k) cp++ ;
  331. X!           for ( ; cp < 60; cp++)
  332. X              {
  333. X                cpi[cp] = cpi[cp + 1] ;
  334. X                cpj[cp] = cpj[cp + 1] ;
  335. X--- 143,149 ----
  336. X            mnb++ ;
  337. X            cp = 0 ;
  338. X            while (cpk[cp] != k) cp++ ;
  339. X!           for ( ; cp < 59; cp++)
  340. X              {
  341. X                cpi[cp] = cpi[cp + 1] ;
  342. X                cpj[cp] = cpj[cp + 1] ;
  343. X***************
  344. X*** 129,135 ****
  345. X  
  346. X    if ((locallevel != level) || (mnb == 1) || (mnb == 2))
  347. X      {
  348. X!       timeleft = timevals[level] * 60 ;
  349. X        locallevel = level ;
  350. X      }
  351. X  
  352. X--- 153,159 ----
  353. X  
  354. X    if ((locallevel != level) || (mnb == 1) || (mnb == 2))
  355. X      {
  356. X!       timeleft = timevals[level-1] * 60 ;
  357. X        locallevel = level ;
  358. X      }
  359. X  
  360. X***************
  361. X*** 137,171 ****
  362. X    for (cp = 0; cp <= 60 - mnb; cp++)
  363. X      if (d0[cpk[cp]] == JPJ) k++ ;
  364. X  
  365. X!   if ((k == 1) || (mnb == 1))
  366. X      {
  367. X-       note = 0 ;
  368. X-       timeused = profmax = 1 ;
  369. X        for (cp = 0; d0[cpk[cp]] != JPJ; cp++) ;
  370. X        cpi[0] = cpi[cp] ;
  371. X        cpj[0] = cpj[cp] ;
  372. X        cpk[0] = cpk[cp] ;
  373. X      }
  374. X    else
  375. X!     { 
  376. X!       count = 0 ;
  377. X!       profmax = 1 ;
  378. X!       allotime = timeleft * 2 / (60 - mnb) ;
  379. X        firsttime = time((time_t *) NULL) ;
  380. X        do
  381. X          {
  382. X            note = -1000000000 ;
  383. X  
  384. X            c1 = 312 + 6 * (mnb + profmax) ;
  385. X            if (mnb + profmax < 25)
  386. X!             c2 = 1000 * (long) (50 + 2 * (mnb + profmax)) ;
  387. X            else
  388. X!             c2 = 1000 * (long) (75 + mnb + profmax) ;
  389. X!           c3 = 4 * (50 - mnb - profmax) ;
  390. X  
  391. X            profmax++ ;
  392. X-           if (profmax > 55 - mnb) profmax = 61 - mnb ;
  393. X  
  394. X            for (cp = 0; cp <= 60 - mnb; cp++)
  395. X              {
  396. X                if (d0[cpk[cp]] == JPJ)
  397. X--- 161,256 ----
  398. X    for (cp = 0; cp <= 60 - mnb; cp++)
  399. X      if (d0[cpk[cp]] == JPJ) k++ ;
  400. X  
  401. X!   count = note = cpmax = 0 ;
  402. X!   timeused = profmax = 1 ;
  403. X! 
  404. X!   if (((k == 1) && (mnb < 52)) || (mnb == 1))
  405. X      {
  406. X        for (cp = 0; d0[cpk[cp]] != JPJ; cp++) ;
  407. X        cpi[0] = cpi[cp] ;
  408. X        cpj[0] = cpj[cp] ;
  409. X        cpk[0] = cpk[cp] ;
  410. X      }
  411. X+   else if (mnb == 2)
  412. X+     {
  413. X+       if (d0[2 * 8 + 3] == BLACK)
  414. X+         {
  415. X+           cpi[0] = 4 ;
  416. X+           cpj[0] = 2 ;
  417. X+         }
  418. X+       else if (d0[3 * 8 + 2] == BLACK)
  419. X+         {
  420. X+           cpi[0] = 2 ;
  421. X+           cpj[0] = 4 ;
  422. X+         }
  423. X+       else if (d0[4 * 8 + 5] == BLACK)
  424. X+         {
  425. X+           cpi[0] = 5 ;
  426. X+           cpj[0] = 3 ;
  427. X+         }
  428. X+       else if (d0[5 * 8 + 4] == BLACK)
  429. X+         {
  430. X+           cpi[0] = 3 ;
  431. X+           cpj[0] = 5 ;
  432. X+         }
  433. X+       cpk[0] = cpi[0] * 8 + cpj[0] ;
  434. X+     }
  435. X+   else if (mnb == 3)
  436. X+     {
  437. X+       if (d0[4 * 8 + 2] == WHITE)
  438. X+         {
  439. X+           cpi[0] = 5 ;
  440. X+           cpj[0] = 3 ;
  441. X+         }
  442. X+       else if (d0[2 * 8 + 2] == WHITE)
  443. X+         {
  444. X+           cpi[0] = 3 ;
  445. X+           cpj[0] = 2 ;
  446. X+         }
  447. X+       else if (d0[2 * 8 + 4] == WHITE)
  448. X+         {
  449. X+           cpi[0] = 3 ;
  450. X+           cpj[0] = 5 ;
  451. X+         }
  452. X+       cpk[0] = cpi[0] * 8 + cpj[0] ;
  453. X+     }
  454. X    else
  455. X!     {
  456. X!       allotime = timeleft * 3 / (61 - mnb) ;
  457. X        firsttime = time((time_t *) NULL) ;
  458. X+ 
  459. X+       signal(SIGALRM, catcher) ;
  460. X+ 
  461. X+       if (setjmp(jumper) != 0)
  462. X+         {
  463. X+           if (cpmax == 0) note = oldnote ;
  464. X+           profmax = -profmax ;
  465. X+           goto trap ;
  466. X+         }
  467. X+ 
  468. X        do
  469. X          {
  470. X+           oldnote = note ;
  471. X            note = -1000000000 ;
  472. X  
  473. X+           if ((int) (allotime - timeused) > 2) alarm(allotime - timeused) ;
  474. X+ 
  475. X            c1 = 312 + 6 * (mnb + profmax) ;
  476. X            if (mnb + profmax < 25)
  477. X!             c2 = 50 + 2 * (mnb + profmax) ;
  478. X            else
  479. X!             c2 = 75 + mnb + profmax ;
  480. X!           c3 = 99 ;
  481. X  
  482. X            profmax++ ;
  483. X  
  484. X+           if (profmax > 53 - mnb)
  485. X+             {
  486. X+               profmax = 61 - mnb ;
  487. X+               allotime = timeleft * 3 / 5 ;
  488. X+               if ((int) (allotime - timeused) > 2) alarm(allotime - timeused) ;
  489. X+             }
  490. X+ 
  491. X            for (cp = 0; cp <= 60 - mnb; cp++)
  492. X              {
  493. X                if (d0[cpk[cp]] == JPJ)
  494. X***************
  495. X*** 185,215 ****
  496. X                      }
  497. X                  }
  498. X              }
  499. X!           if (cpmax == 0) count++ ;
  500. X            else
  501. X              {
  502. X!               count = 1 ;
  503. X!               k = cpi[0] ;
  504. X!               cpi[0] = cpi[cpmax] ;
  505. X!               cpi[cpmax] = k ;
  506. X!               k = cpj[0] ;
  507. X!               cpj[0] = cpj[cpmax] ;
  508. X!               cpj[cpmax] = k ;
  509. X!               k = cpk[0] ;
  510. X!               cpk[0] = cpk[cpmax] ;
  511. X!               cpk[cpmax] = k ;
  512. X              }
  513. X            timeused = time((time_t *) NULL) - firsttime ;
  514. X!           if (count < 3) fact = 1 ;
  515. X!           else           fact = 3 ;
  516. X          }
  517. X!       while ((timeused * fact < allotime) && (profmax <= 60 - mnb)) ;
  518. X        if (timeused == 0) timeused = 1 ;
  519. X      }
  520. X  
  521. X!   timeleft -= timeused ;
  522. X  
  523. X!   *rtnmv = cpk[0] ;
  524. X    *rtnnote = note ;
  525. X  }
  526. X  
  527. X--- 270,349 ----
  528. X                      }
  529. X                  }
  530. X              }
  531. X! 
  532. X!           alarm(0) ;
  533. X!           cpmaxi[0] = cpmax ;
  534. X! 
  535. X!           if ((mnb < 57) && (cpmaxi[0] != cpmaxi[1])
  536. X!               && (cpmaxi[1] != cpmaxi[2]) && (cpmaxi[0] != cpmaxi[2]))
  537. X!             {
  538. X!               if (cpmax == 0) count++ ; else count = 1 ;
  539. X!               for (cp = 0; cp <= 60 - mnb; cp++) cpf[cp] = TRUE ;
  540. X!               for (k = 0; k < 3; k++)
  541. X!                 {
  542. X!                   cpi2[k] = cpi[cpmaxi[k]] ;
  543. X!                   cpj2[k] = cpj[cpmaxi[k]] ;
  544. X!                   cpk2[k] = cpk[cpmaxi[k]] ;
  545. X!                   cpf[cpmaxi[k]] = FALSE ;
  546. X!                 }
  547. X!               k = 3 ;
  548. X!               for (cp = 0; cp <= 60 - mnb; cp++)
  549. X!                 if (cpf[cp] == TRUE)
  550. X!                   {
  551. X!                     cpi2[k] = cpi[cp] ;
  552. X!                     cpj2[k] = cpj[cp] ;
  553. X!                     cpk2[k] = cpk[cp] ;
  554. X!                     k++ ;
  555. X!                   }
  556. X!               for (cp = 0; cp <= 60 - mnb; cp++)
  557. X!                 {
  558. X!                   cpi[cp] = cpi2[cp] ;
  559. X!                   cpj[cp] = cpj2[cp] ;
  560. X!                   cpk[cp] = cpk2[cp] ;
  561. X!                 }
  562. X!             }
  563. X            else
  564. X              {
  565. X!               cpi2[0] = cpi[cpmax] ;
  566. X!               cpj2[0] = cpj[cpmax] ;
  567. X!               cpk2[0] = cpk[cpmax] ;
  568. X!               cpi[cpmax] = cpi[0] ;
  569. X!               cpj[cpmax] = cpj[0] ;
  570. X!               cpk[cpmax] = cpk[0] ;
  571. X!               cpi[0] = cpi2[0] ;
  572. X!               cpj[0] = cpj2[0] ;
  573. X!               cpk[0] = cpk2[0] ;
  574. X              }
  575. X+           cpmax = 0 ;
  576. X            timeused = time((time_t *) NULL) - firsttime ;
  577. X!           if ((mnb == 4) && (profmax == 3)) break ;
  578. X          }
  579. X!       while ((timeused * count < allotime * 5 / 4) && (profmax != 61 - mnb)) ;
  580. X! trap:
  581. X!       timeused = time((time_t *) NULL) - firsttime ;
  582. X        if (timeused == 0) timeused = 1 ;
  583. X      }
  584. X  
  585. X!   if (*rtnmv == TRUE) timeleft -= timeused ;
  586. X!   if ((int) timeleft < 0) timeleft = 0 ;
  587. X  
  588. X!   if (saveres)
  589. X!     {
  590. X!       if ((mnb == 1) || (mnb == 2))
  591. X!         {
  592. X!           fp = fopen("reve.res", "w") ;
  593. X!           FPRINTF(fp, "\n") ;
  594. X!           FCLOSE(fp) ;
  595. X!         }
  596. X!       fp = fopen("reve.res", "a") ;
  597. X!       FPRINTF(fp, "%2d, <%c-%c>, ", mnb, 'A' + cpj[cpmax], '1' + cpi[cpmax]) ;
  598. X!       FPRINTF(fp, "nt : %5d, pmax : %3d, tmleft : %d, level : %d, ",
  599. X!                    note,     profmax,    timeleft, level) ;
  600. X!       FPRINTF(fp, "exp : <%c-%c>\n", 'A' + cpj[1], '1' + cpi[1]) ;
  601. X!       FCLOSE(fp) ;
  602. X!     }
  603. X! 
  604. X!   *rtnmv = cpk[cpmax] ;
  605. X    *rtnnote = note ;
  606. X  }
  607. X  
  608. X***************
  609. X*** 220,226 ****
  610. X  long alpha, beta ;
  611. X  {
  612. X    register int *d0, *d1 ;
  613. X!   register int k, cp ;
  614. X    register long lnote, note ;
  615. X  
  616. X    d0 = damier[niv] ;
  617. X--- 354,360 ----
  618. X  long alpha, beta ;
  619. X  {
  620. X    register int *d0, *d1 ;
  621. X!   register int k, cp, cpmax ;
  622. X    register long lnote, note ;
  623. X  
  624. X    d0 = damier[niv] ;
  625. X***************
  626. X*** 241,250 ****
  627. X              lnote = tuplonges(niv + 1, alpha, note) ;
  628. X            else
  629. X              lnote = evalue(niv + 1) ;
  630. X!           if (lnote < note) note = lnote ;
  631. X            if (note <= alpha) return note ;
  632. X          }
  633. X      }
  634. X    return note ;
  635. X  }
  636. X  
  637. X--- 375,397 ----
  638. X              lnote = tuplonges(niv + 1, alpha, note) ;
  639. X            else
  640. X              lnote = evalue(niv + 1) ;
  641. X!           if (lnote < note)
  642. X!             {
  643. X!               note = lnote ;
  644. X!               cpmax = cp ;
  645. X!             }
  646. X            if (note <= alpha) return note ;
  647. X          }
  648. X      }
  649. X+ 
  650. X+   if (niv == 1)
  651. X+     {
  652. X+       cpmaxi[1] = cpmax ;
  653. X+       cpmaxi[2] = cpmaxi[3] ;
  654. X+     }
  655. X+   else if (niv == 2)
  656. X+     cpmaxi[3] = cpmax ;
  657. X+ 
  658. X    return note ;
  659. X  }
  660. X  
  661. X***************
  662. X*** 255,261 ****
  663. X  long alpha, beta ;
  664. X  {
  665. X    register int *d0, *d1 ;
  666. X!   register int k, cp ;
  667. X    register long lnote, note ;
  668. X  
  669. X    d0 = damier[niv] ;
  670. X--- 402,408 ----
  671. X  long alpha, beta ;
  672. X  {
  673. X    register int *d0, *d1 ;
  674. X!   register int k, cp, cpmax ;
  675. X    register long lnote, note ;
  676. X  
  677. X    d0 = damier[niv] ;
  678. X***************
  679. X*** 276,284 ****
  680. X              lnote = jeplonge(niv + 1, note, beta) ;
  681. X            else
  682. X              lnote = evalue(niv + 1) ;
  683. X!           if (lnote > note) note = lnote ;
  684. X            if (note >= beta) return note ;
  685. X          }
  686. X      }
  687. X    return note ;
  688. X  }
  689. X--- 423,444 ----
  690. X              lnote = jeplonge(niv + 1, note, beta) ;
  691. X            else
  692. X              lnote = evalue(niv + 1) ;
  693. X!           if (lnote > note)
  694. X!             {
  695. X!               note = lnote ;
  696. X!               cpmax = cp ;
  697. X!             }
  698. X            if (note >= beta) return note ;
  699. X          }
  700. X      }
  701. X+ 
  702. X+   if (niv == 1)
  703. X+     {
  704. X+       cpmaxi[1] = cpmax ;
  705. X+       cpmaxi[2] = cpmaxi[3] ;
  706. X+     }
  707. X+   else if (niv == 2)
  708. X+     cpmaxi[3] = cpmax ;
  709. X+ 
  710. X    return note ;
  711. X  }
  712. X
  713. X------- rev_iycp.c -------
  714. X*** /tmp/da28914    Fri Nov  9 10:39:57 1990
  715. X--- rev_iycp.c    Mon Nov  5 09:10:39 1990
  716. X***************
  717. X*** 3,13 ****
  718. X   *
  719. X   *  Copyright (C) 1990 - Yves Gallot - all rights reserved.
  720. X   *
  721. X!  *  Permission is given to distribute these sources, as long as the
  722. X!  *  introductory messages are not removed, and no monies are exchanged.
  723. X   *
  724. X!  *  You are forbidden from using Reve as is, or in a modified state, in
  725. X!  *  any tournaments, without the permission of the authors.
  726. X   *
  727. X   *  No responsibility is taken for any errors on inaccuracies inherent
  728. X   *  either to the comments or the code of this program, but if reported
  729. X--- 3,18 ----
  730. X   *
  731. X   *  Copyright (C) 1990 - Yves Gallot - all rights reserved.
  732. X   *
  733. X!  *  Permission is granted to copy this source, for redistribution
  734. X!  *  in source form only, provided the news headers in "substantially
  735. X!  *  unaltered format" are retained, the introductory messages are not
  736. X!  *  removed, and no monies are exchanged.
  737. X   *
  738. X!  *  Permission is also granted to copy this source, without the
  739. X!  *  news headers, for the purposes of making an executable copy by
  740. X!  *  means of compilation, provided that such copy will not be used
  741. X!  *  for the purposes of competition in any othello tournaments, without
  742. X!  *  prior permission from the authors.
  743. X   *
  744. X   *  No responsibility is taken for any errors on inaccuracies inherent
  745. X   *  either to the comments or the code of this program, but if reported
  746. X
  747. X------- reve.h -------
  748. X*** /tmp/da28917    Fri Nov  9 10:39:58 1990
  749. X--- reve.h    Mon Nov  5 09:07:58 1990
  750. X***************
  751. X*** 6,16 ****
  752. X   *  Copyright (C) 1990 - Rich Burridge & Yves Gallot.
  753. X   *  All rights reserved.
  754. X   *
  755. X!  *  Permission is given to distribute these sources, as long as the
  756. X!  *  introductory messages are not removed, and no monies are exchanged.
  757. X   *
  758. X!  *  You are forbidden from using Reve as is, or in a modified state, in
  759. X!  *  any tournaments, without the permission of the authors.
  760. X   *
  761. X   *  No responsibility is taken for any errors on inaccuracies inherent
  762. X   *  either to the comments or the code of this program, but if reported
  763. X--- 6,21 ----
  764. X   *  Copyright (C) 1990 - Rich Burridge & Yves Gallot.
  765. X   *  All rights reserved.
  766. X   *
  767. X!  *  Permission is granted to copy this source, for redistribution
  768. X!  *  in source form only, provided the news headers in "substantially
  769. X!  *  unaltered format" are retained, the introductory messages are not
  770. X!  *  removed, and no monies are exchanged.
  771. X   *
  772. X!  *  Permission is also granted to copy this source, without the
  773. X!  *  news headers, for the purposes of making an executable copy by
  774. X!  *  means of compilation, provided that such copy will not be used
  775. X!  *  for the purposes of competition in any othello tournaments, without
  776. X!  *  prior permission from the authors.
  777. X   *
  778. X   *  No responsibility is taken for any errors on inaccuracies inherent
  779. X   *  either to the comments or the code of this program, but if reported
  780. X***************
  781. X*** 17,26 ****
  782. X   *  (see README file), then an attempt will be made to fix them.
  783. X   */
  784. X  
  785. X  #define  FCLOSE        (void) fclose      /* To make lint happy. */
  786. X  #define  FFLUSH        (void) fflush
  787. X  #define  FGETS         (void) fgets
  788. X- #define  FREAD         (void) fread
  789. X  #define  FSEEK         (void) fseek
  790. X  #define  FPRINTF       (void) fprintf
  791. X  #define  GETTIMEOFDAY  (void) gettimeofday
  792. X--- 22,33 ----
  793. X   *  (see README file), then an attempt will be made to fix them.
  794. X   */
  795. X  
  796. X+ #include <stdio.h>
  797. X+ #include <sys/types.h>
  798. X+ 
  799. X  #define  FCLOSE        (void) fclose      /* To make lint happy. */
  800. X  #define  FFLUSH        (void) fflush
  801. X  #define  FGETS         (void) fgets
  802. X  #define  FSEEK         (void) fseek
  803. X  #define  FPRINTF       (void) fprintf
  804. X  #define  GETTIMEOFDAY  (void) gettimeofday
  805. X***************
  806. X*** 42,57 ****
  807. X  #define  BGAP          10       /* Width of the gap between buttons. */
  808. X  #define  BHEIGHT       32       /* Height of a reve button item. */
  809. X  #define  BWIDTH        64       /* Width of a reve button item. */
  810. X- #define  CELL_SIZE     (int) ((TOTAL_WIDTH-(2*BBORDER)) / BOARD_SIZE)
  811. X  #define  CHEIGHT       20       /* Height of a reve cycle item. */
  812. X  #define  CWIDTH        32       /* Width of a reve cycle item. */
  813. X- #define  CY            ((NOROWS*BHEIGHT) + ((NOROWS-1)*BGAP) + (2*BBORDER))
  814. X  #define  NOBUTS        6        /* Number of reve buttons. */
  815. X- #define  NOROWS        6        /* Number of rows of reve items. */
  816. X  #define  PIECE_MARGIN  8
  817. X  #define  PIECE_RAD     (CELL_SIZE / 2 - PIECE_MARGIN)
  818. X  #define  TOTAL_HEIGHT  CY + (8 * CELL_SIZE) + (2 * BBORDER)
  819. X  #define  TOTAL_WIDTH   ((NOBUTS*BWIDTH) + ((NOBUTS-1)*BGAP) + (2*BBORDER))
  820. X  
  821. X  /* States that the the Reve squares can be in. */
  822. X  #define  BLACK         (-1)    /* Piece definitions. */
  823. X--- 49,73 ----
  824. X  #define  BGAP          10       /* Width of the gap between buttons. */
  825. X  #define  BHEIGHT       32       /* Height of a reve button item. */
  826. X  #define  BWIDTH        64       /* Width of a reve button item. */
  827. X  #define  CHEIGHT       20       /* Height of a reve cycle item. */
  828. X  #define  CWIDTH        32       /* Width of a reve cycle item. */
  829. X  #define  NOBUTS        6        /* Number of reve buttons. */
  830. X  #define  PIECE_MARGIN  8
  831. X  #define  PIECE_RAD     (CELL_SIZE / 2 - PIECE_MARGIN)
  832. X+ 
  833. X+ #ifdef XVIEW
  834. X+ #define  CELL_SIZE     54
  835. X+ #define  CY            0
  836. X+ #define  NOROWS        0
  837. X+ #define  TOTAL_HEIGHT  (8 * CELL_SIZE) + (2 * BBORDER)
  838. X+ #define  TOTAL_WIDTH   (8 * CELL_SIZE) + (2 * BBORDER)
  839. X+ #else
  840. X+ #define  CELL_SIZE     (int) ((TOTAL_WIDTH-(2*BBORDER)) / BOARD_SIZE)
  841. X+ #define  CY            ((NOROWS*BHEIGHT) + ((NOROWS-1)*BGAP) + (2*BBORDER))
  842. X+ #define  NOROWS        6        /* Number of rows of reve items. */
  843. X  #define  TOTAL_HEIGHT  CY + (8 * CELL_SIZE) + (2 * BBORDER)
  844. X  #define  TOTAL_WIDTH   ((NOBUTS*BWIDTH) + ((NOBUTS-1)*BGAP) + (2*BBORDER))
  845. X+ #endif /*XVIEW*/
  846. X  
  847. X  /* States that the the Reve squares can be in. */
  848. X  #define  BLACK         (-1)    /* Piece definitions. */
  849. X***************
  850. X*** 91,104 ****
  851. X  
  852. X  #ifndef  MAXLINE
  853. X  #define  MAXLINE       80      /* Length of character strings. */
  854. X! #endif /*MAXLINE*/
  855. X  
  856. X  #define  MAXMENUS      4       /* Maximum number of popup menus. */
  857. X  #define  NIVEAUMAX     25      /* Maximum possible depth. */
  858. X  
  859. X  #ifdef  NOINDEX
  860. X  #define  index         strchr
  861. X  #endif /*NOINDEX*/
  862. X  
  863. X  #define  NOMOVE        -1
  864. X  #define  OPPONENT(p)   p * -1
  865. X--- 107,122 ----
  866. X  
  867. X  #ifndef  MAXLINE
  868. X  #define  MAXLINE       80      /* Length of character strings. */
  869. X! #endif /*!MAXLINE*/
  870. X  
  871. X  #define  MAXMENUS      4       /* Maximum number of popup menus. */
  872. X  #define  NIVEAUMAX     25      /* Maximum possible depth. */
  873. X  
  874. X+ #ifndef X11
  875. X  #ifdef  NOINDEX
  876. X  #define  index         strchr
  877. X  #endif /*NOINDEX*/
  878. X+ #endif /*!X11*/
  879. X  
  880. X  #define  NOMOVE        -1
  881. X  #define  OPPONENT(p)   p * -1
  882. X***************
  883. X*** 116,128 ****
  884. X  
  885. X  #ifndef  EDGENAME
  886. X  #define  EDGENAME      "reve.edgetable"
  887. X! #endif /*EDGENAME*/
  888. X  
  889. X! #ifndef  NO_4_3SIGNAL
  890. X  #define  SIGRET        void
  891. X  #else
  892. X  #define  SIGRET        int
  893. X! #endif /*NO_4_3SIGNAL*/
  894. X  
  895. X  #define  VINVUL        50
  896. X  
  897. X--- 134,146 ----
  898. X  
  899. X  #ifndef  EDGENAME
  900. X  #define  EDGENAME      "reve.edgetable"
  901. X! #endif /*!EDGENAME*/
  902. X  
  903. X! #ifndef  INT_SIGNAL
  904. X  #define  SIGRET        void
  905. X  #else
  906. X  #define  SIGRET        int
  907. X! #endif /*!INT_SIGNAL*/
  908. X  
  909. X  #define  VINVUL        50
  910. X  
  911. X***************
  912. X*** 140,146 ****
  913. X  #define  MOUSE_MOVING     110    /* Mouse is moving. */
  914. X  #define  IGNORE_EVENT     111    /* No interest in this event. */
  915. X  
  916. X! /* Batch or locking direction (ON or OFF). */
  917. X  enum bltype   { IS_OFF, IS_ON } ;
  918. X  
  919. X  /* Reve move status. */
  920. X--- 158,164 ----
  921. X  #define  MOUSE_MOVING     110    /* Mouse is moving. */
  922. X  #define  IGNORE_EVENT     111    /* No interest in this event. */
  923. X  
  924. X! /* Batch, last move, locking or show all direction (ON or OFF). */
  925. X  enum bltype   { IS_OFF, IS_ON } ;
  926. X  
  927. X  /* Reve move status. */
  928. X***************
  929. X*** 167,176 ****
  930. X  enum item_type { P_BUTTON, P_CYCLE, P_MESSAGE } ;
  931. X  
  932. X  /* Different panel items. */
  933. X! enum panel_type { LAST_BUT,    LOAD_BUT, NEW_GAME_BUT, SAVE_BUT,
  934. X                    SUGGEST_BUT, UNDO_BUT, DONE_BUT, CANCEL_BUT, QUIT_BUT,
  935. X                    BLACK_PLAYS, WHITE_PLAYS, DIFFICULTY, NOTES,
  936. X!                   PANEL_MES, NOTES_MES, SCORE_MES, TURN_MES } ;
  937. X  
  938. X  enum set_type { INCREMENT, DECREMENT, NONE } ;   /* Cycle directions. */
  939. X  
  940. X--- 185,194 ----
  941. X  enum item_type { P_BUTTON, P_CYCLE, P_MESSAGE } ;
  942. X  
  943. X  /* Different panel items. */
  944. X! enum panel_type { LOAD_BUT, NEW_GAME_BUT, SAVE_BUT, SHOW_ALL_BUT,
  945. X                    SUGGEST_BUT, UNDO_BUT, DONE_BUT, CANCEL_BUT, QUIT_BUT,
  946. X                    BLACK_PLAYS, WHITE_PLAYS, DIFFICULTY, NOTES,
  947. X!                   PANEL_MES, EVAL_MES, SCORE_MES, TURN_MES } ;
  948. X  
  949. X  enum set_type { INCREMENT, DECREMENT, NONE } ;   /* Cycle directions. */
  950. X  
  951. X***************
  952. X*** 187,192 ****
  953. X--- 205,211 ----
  954. X            int move ;
  955. X            int moves_left ;
  956. X            long note ;
  957. X+           time_t timeleft ;
  958. X  } BOARD ;
  959. X  
  960. X  struct iteminfo               /* Item information record. */
  961. X***************
  962. X*** 213,233 ****
  963. X  void done(),               draw_button(),        draw_cycle() ;
  964. X  void draw_cycle_item(),    draw_image(),         draw_line() ;
  965. X  void draw_piece(),         draw_rect(),          draw_stencil() ;
  966. X! void draw_text(),          draw_textfield(),     get_filename() ;
  967. X  void get_options(),        get_xy(),             getparam() ;
  968. X  void handle_board_event(), handle_event(),       handle_item() ;
  969. X  void handle_key(),         init_canvas(),        init_edge_table() ;
  970. X  void init_fonts(),         init_notes(),         init_player() ;
  971. X  void initboard(),          initialise() ;
  972. X! void last(),               load_colors(),        load_game() ;
  973. X! void lock_screen() ;
  974. X  void make_canvas(),        make_frame(),         make_icon() ;
  975. X  void make_message(),       make_move(),          make_panel() ;
  976. X! void message(),            nap_upto() ;
  977. X! void new_game(),           process_event(),      quit() ;
  978. X  void remove_textfield(),   save_game(),          set_cursor() ;
  979. X  void set_cycle(),          set_display_types() ;
  980. X  void set_timer(),          set_score(),          set_turn() ;
  981. X  void show_suggestion(),    start_tool() ;
  982. X  void suggest(),            think(),              undo() ;
  983. X  void update_board_image(), usage(),              who_wins() ;
  984. X--- 232,253 ----
  985. X  void done(),               draw_button(),        draw_cycle() ;
  986. X  void draw_cycle_item(),    draw_image(),         draw_line() ;
  987. X  void draw_piece(),         draw_rect(),          draw_stencil() ;
  988. X! void draw_text(),          draw_textfield() ;
  989. X! void generate_graphics(),  get_filename() ;
  990. X  void get_options(),        get_xy(),             getparam() ;
  991. X  void handle_board_event(), handle_event(),       handle_item() ;
  992. X  void handle_key(),         init_canvas(),        init_edge_table() ;
  993. X  void init_fonts(),         init_notes(),         init_player() ;
  994. X  void initboard(),          initialise() ;
  995. X! void load_colors(),        load_game(),          lock_screen() ;
  996. X  void make_canvas(),        make_frame(),         make_icon() ;
  997. X  void make_message(),       make_move(),          make_panel() ;
  998. X! void message(),            nap_upto(),           new_game() ;
  999. X! void position_popup(),     process_event(),      quit() ;
  1000. X  void remove_textfield(),   save_game(),          set_cursor() ;
  1001. X  void set_cycle(),          set_display_types() ;
  1002. X  void set_timer(),          set_score(),          set_turn() ;
  1003. X+ void show_all(),           show_all_moves(),     show_last() ;
  1004. X  void show_suggestion(),    start_tool() ;
  1005. X  void suggest(),            think(),              undo() ;
  1006. X  void update_board_image(), usage(),              who_wins() ;
  1007. X
  1008. X------- tty.c -------
  1009. X*** /tmp/da28926    Fri Nov  9 10:40:00 1990
  1010. X--- tty.c    Mon Nov  5 09:08:40 1990
  1011. X***************
  1012. X*** 7,17 ****
  1013. X   *  Copyright (C) 1990 - Rich Burridge & Yves Gallot.
  1014. X   *  All rights reserved.
  1015. X   *
  1016. X!  *  Permission is given to distribute these sources, as long as the
  1017. X!  *  introductory messages are not removed, and no monies are exchanged.
  1018. X   *
  1019. X!  *  You are forbidden from using Reve as is, or in a modified state, in
  1020. X!  *  any tournaments, without the permission of the authors.
  1021. X   *
  1022. X   *  No responsibility is taken for any errors or inaccuracies inherent
  1023. X   *  either to the comments or the code of this program, but if reported
  1024. X--- 7,22 ----
  1025. X   *  Copyright (C) 1990 - Rich Burridge & Yves Gallot.
  1026. X   *  All rights reserved.
  1027. X   *
  1028. X!  *  Permission is granted to copy this source, for redistribution
  1029. X!  *  in source form only, provided the news headers in "substantially
  1030. X!  *  unaltered format" are retained, the introductory messages are not
  1031. X!  *  removed, and no monies are exchanged.
  1032. X   *
  1033. X!  *  Permission is also granted to copy this source, without the
  1034. X!  *  news headers, for the purposes of making an executable copy by
  1035. X!  *  means of compilation, provided that such copy will not be used
  1036. X!  *  for the purposes of competition in any othello tournaments, without
  1037. X!  *  prior permission from the authors.
  1038. X   *
  1039. X   *  No responsibility is taken for any errors or inaccuracies inherent
  1040. X   *  either to the comments or the code of this program, but if reported
  1041. X***************
  1042. X*** 18,36 ****
  1043. X   *  (see README file), then an attempt will be made to fix them.
  1044. X   */
  1045. X  
  1046. X! #include <stdio.h>
  1047. X! #include <strings.h>
  1048. X  #include <sys/ioctl.h>
  1049. X  #include <signal.h>
  1050. X  
  1051. X  #ifdef SYSV
  1052. X  #include <sgtty.h>
  1053. X  #endif /*SYSV*/
  1054. X  
  1055. X- #include "reve.h"
  1056. X- #include "color.h"
  1057. X- #include "extern.h"
  1058. X- 
  1059. X  #define  DRAW_STRING(col, row, str, v)  draw_string(col, row, str, v), return
  1060. X  
  1061. X  enum gr_type gtype = GTTY ;      /* Graphics type. */
  1062. X--- 23,41 ----
  1063. X   *  (see README file), then an attempt will be made to fix them.
  1064. X   */
  1065. X  
  1066. X! #include "reve.h"
  1067. X! #include "color.h"
  1068. X! #include "extern.h"
  1069. X  #include <sys/ioctl.h>
  1070. X  #include <signal.h>
  1071. X  
  1072. X  #ifdef SYSV
  1073. X+ #include <string.h>
  1074. X  #include <sgtty.h>
  1075. X+ #else
  1076. X+ #include <strings.h>
  1077. X  #endif /*SYSV*/
  1078. X  
  1079. X  #define  DRAW_STRING(col, row, str, v)  draw_string(col, row, str, v), return
  1080. X  
  1081. X  enum gr_type gtype = GTTY ;      /* Graphics type. */
  1082. X***************
  1083. X*** 60,69 ****
  1084. X  } ;
  1085. X  
  1086. X  struct tty_info ttyvals[MAXITEMS] = {
  1087. X!       {  1,  1,  33,  33, },      /* Last */
  1088. X!       { 11,  1, 107,  33, },      /* Load */
  1089. X!       { 22,  1, 167,  33, },      /* New game */
  1090. X!       { 33,  1, 255,  33, },      /* Save */
  1091. X        { 44,  1, 318,  33, },      /* Suggest */
  1092. X        { 55,  1, 403,  33, },      /* Undo */
  1093. X        { -1, -1,  33,  75, },      /* Done   (not displayed). */
  1094. X--- 65,74 ----
  1095. X  } ;
  1096. X  
  1097. X  struct tty_info ttyvals[MAXITEMS] = {
  1098. X!       {  1,  1,  33,  33, },      /* Load */
  1099. X!       { 11,  1, 107,  33, },      /* New game */
  1100. X!       { 22,  1, 167,  33, },      /* Save */
  1101. X!       { 33,  1, 255,  33, },      /* Show all */
  1102. X        { 44,  1, 318,  33, },      /* Suggest */
  1103. X        { 55,  1, 403,  33, },      /* Undo */
  1104. X        { -1, -1,  33,  75, },      /* Done   (not displayed). */
  1105. X***************
  1106. X*** 85,94 ****
  1107. X  } ;
  1108. X  
  1109. X  struct other_info othervals[MAXITEMS] = {
  1110. X-       { -1, -1, },       /* Last     (ignored). */
  1111. X        { -1, -1, },       /* Load     (ignored). */
  1112. X        { -1, -1, },       /* New game (ignored). */
  1113. X        { -1, -1, },       /* Save     (ignored). */
  1114. X        { -1, -1, },       /* Suggest  (ignored). */
  1115. X        { -1, -1, },       /* Undo     (ignored). */
  1116. X        { -1, -1, },       /* Done     (ignored). */
  1117. X--- 90,99 ----
  1118. X  } ;
  1119. X  
  1120. X  struct other_info othervals[MAXITEMS] = {
  1121. X        { -1, -1, },       /* Load     (ignored). */
  1122. X        { -1, -1, },       /* New game (ignored). */
  1123. X        { -1, -1, },       /* Save     (ignored). */
  1124. X+       { -1, -1, },       /* Show all (ignored). */
  1125. X        { -1, -1, },       /* Suggest  (ignored). */
  1126. X        { -1, -1, },       /* Undo     (ignored). */
  1127. X        { -1, -1, },       /* Done     (ignored). */
  1128. X***************
  1129. X*** 346,353 ****
  1130. X      }
  1131. X    else if (x == 237 && y == 195)       /* Note message. */
  1132. X      {
  1133. X!       draw_string(othervals[(int) NOTES_MES].column,
  1134. X!                   othervals[(int) NOTES_MES].row, str, TRUE) ;
  1135. X        return ;
  1136. X      }
  1137. X    else if (x == 15 && y == 237)        /* Score message. */
  1138. X--- 351,358 ----
  1139. X      }
  1140. X    else if (x == 237 && y == 195)       /* Note message. */
  1141. X      {
  1142. X!       draw_string(othervals[(int) EVAL_MES].column,
  1143. X!                   othervals[(int) EVAL_MES].row, str, TRUE) ;
  1144. X        return ;
  1145. X      }
  1146. X    else if (x == 15 && y == 237)        /* Score message. */
  1147. X***************
  1148. X*** 371,378 ****
  1149. X      if (EQUAL(str, items[i].text))
  1150. X        if (ttyvals[i].column != -1)
  1151. X          {
  1152. X!                if (EQUAL(str, "load")) STRCPY(str, "Load") ;
  1153. X!           else if (EQUAL(str, "save")) STRCPY(str, "Save") ;
  1154. X            draw_string(ttyvals[i].column, ttyvals[i].row, str, FALSE) ;
  1155. X            return ;
  1156. X          }
  1157. X--- 376,384 ----
  1158. X      if (EQUAL(str, items[i].text))
  1159. X        if (ttyvals[i].column != -1)
  1160. X          {
  1161. X!                if (EQUAL(str, "load"))     STRCPY(str, "Load") ;
  1162. X!           else if (EQUAL(str, "save"))     STRCPY(str, "Save") ;
  1163. X!           else if (EQUAL(str, "show all")) STRCPY(str, "show All") ;
  1164. X            draw_string(ttyvals[i].column, ttyvals[i].row, str, FALSE) ;
  1165. X            return ;
  1166. X          }
  1167. X
  1168. X------- x11.c -------
  1169. X*** /tmp/da28929    Fri Nov  9 10:40:00 1990
  1170. X--- x11.c    Thu Nov  8 10:28:39 1990
  1171. X***************
  1172. X*** 7,17 ****
  1173. X   *  Copyright (c) 1990 - Rich Burridge & Yves Gallot.
  1174. X   *  All rights reserved.
  1175. X   *
  1176. X!  *  Permission is given to distribute these sources, as long as the
  1177. X!  *  introductory messages are not removed, and no monies are exchanged.
  1178. X   *
  1179. X!  *  You are forbidden from using Reve as is, or in a modified state, in
  1180. X!  *  any tournaments, without the permission of the authors.
  1181. X   *
  1182. X   *  No responsibility is taken for any errors or inaccuracies inherent
  1183. X   *  either to the comments or the code of this program, but if reported
  1184. X--- 7,22 ----
  1185. X   *  Copyright (c) 1990 - Rich Burridge & Yves Gallot.
  1186. X   *  All rights reserved.
  1187. X   *
  1188. X!  *  Permission is granted to copy this source, for redistribution
  1189. X!  *  in source form only, provided the news headers in "substantially
  1190. X!  *  unaltered format" are retained, the introductory messages are not
  1191. X!  *  removed, and no monies are exchanged.
  1192. X   *
  1193. X!  *  Permission is also granted to copy this source, without the
  1194. X!  *  news headers, for the purposes of making an executable copy by
  1195. X!  *  means of compilation, provided that such copy will not be used
  1196. X!  *  for the purposes of competition in any othello tournaments, without
  1197. X!  *  prior permission from the authors.
  1198. X   *
  1199. X   *  No responsibility is taken for any errors or inaccuracies inherent
  1200. X   *  either to the comments or the code of this program, but if reported
  1201. X***************
  1202. X*** 18,30 ****
  1203. X   *  (see README file), then an attempt will be made to fix them.
  1204. X   */
  1205. X  
  1206. X- #include <stdio.h>
  1207. X- #include <strings.h>
  1208. X- #include <sys/time.h>
  1209. X  #include "reve.h"
  1210. X  #include "color.h"
  1211. X  #include "extern.h"
  1212. X  #include "images.h"
  1213. X  #include <X11/Xlib.h>
  1214. X  #include <X11/Xutil.h>
  1215. X  #include <X11/Xatom.h>
  1216. X--- 23,40 ----
  1217. X   *  (see README file), then an attempt will be made to fix them.
  1218. X   */
  1219. X  
  1220. X  #include "reve.h"
  1221. X  #include "color.h"
  1222. X  #include "extern.h"
  1223. X  #include "images.h"
  1224. X+ #include <sys/time.h>
  1225. X+ 
  1226. X+ #ifdef SYSV
  1227. X+ #include <string.h>
  1228. X+ #else
  1229. X+ #include <strings.h>
  1230. X+ #endif /*SYSV*/
  1231. X+ 
  1232. X  #include <X11/Xlib.h>
  1233. X  #include <X11/Xutil.h>
  1234. X  #include <X11/Xatom.h>
  1235. X***************
  1236. X*** 53,59 ****
  1237. X  GC stencilgc[MAXDPY] ;          /* Graphics context for stencils. */
  1238. X  Pixmap images[MAXIMAGES] ;
  1239. X  Pixmap no_pixmap ;
  1240. X! Pixmap load_color_icon(), load_image(), reve_icon ;
  1241. X  Window frame[MAXDPY], root[MAXDPY] ;
  1242. X  XClassHint class_hint = { "reve", "Reve" } ;
  1243. X  XColor BGcolor, FGcolor ;
  1244. X--- 63,69 ----
  1245. X  GC stencilgc[MAXDPY] ;          /* Graphics context for stencils. */
  1246. X  Pixmap images[MAXIMAGES] ;
  1247. X  Pixmap no_pixmap ;
  1248. X! Pixmap load_color_icon(), load_image(), reve_icon[MAXDPY] ;
  1249. X  Window frame[MAXDPY], root[MAXDPY] ;
  1250. X  XClassHint class_hint = { "reve", "Reve" } ;
  1251. X  XColor BGcolor, FGcolor ;
  1252. X***************
  1253. X*** 62,68 ****
  1254. X  XSizeHints size ;
  1255. X  XWMHints wm_hints ;
  1256. X  XGCValues gc_val ;              /* Used to setup graphics context values. */
  1257. X- int cmap_loaded ;               /* Set if we've already loaded the colormap. */
  1258. X  int gc_flags ;                  /* Used to set up graphics context flags. */
  1259. X  int screen[MAXDPY] ;            /* Default graphics display screen. */
  1260. X  int xfd[MAXDPY] ;               /* Server connection file descriptors. */
  1261. X--- 72,77 ----
  1262. X***************
  1263. X*** 79,85 ****
  1264. X  fd_set fullmask ;            /* Full mask of file descriptors to check on. */
  1265. X  fd_set readmask ;            /* Readmask used in select call. */
  1266. X  #endif /*NO_43SELECT*/
  1267. X! #endif /*NOSELECT*/
  1268. X  
  1269. X  /*  256-byte table for quickly reversing the bits in an unsigned 8-bit char,
  1270. X   *  used to convert between MSBFirst and LSBFirst image formats.
  1271. X--- 88,94 ----
  1272. X  fd_set fullmask ;            /* Full mask of file descriptors to check on. */
  1273. X  fd_set readmask ;            /* Readmask used in select call. */
  1274. X  #endif /*NO_43SELECT*/
  1275. X! #endif /*!NOSELECT*/
  1276. X  
  1277. X  /*  256-byte table for quickly reversing the bits in an unsigned 8-bit char,
  1278. X   *  used to convert between MSBFirst and LSBFirst image formats.
  1279. X***************
  1280. X*** 221,227 ****
  1281. X  
  1282. X    d = (int) cur_dpyno ;
  1283. X    if (iscolor[d]) gc_val.foreground = palette[color] ;
  1284. X!   else            gc_val.foreground = foregnd[d] ;
  1285. X    gc_val.function = opvals[(int) op] ;
  1286. X    XChangeGC(dpy[d], gc[d], GCForeground | GCFunction, &gc_val) ;
  1287. X    XDrawLine(dpy[d], frame[d], gc[d], x1, y1, x2, y2) ;
  1288. X--- 230,240 ----
  1289. X  
  1290. X    d = (int) cur_dpyno ;
  1291. X    if (iscolor[d]) gc_val.foreground = palette[color] ;
  1292. X!   else
  1293. X!     {
  1294. X!       if (color == C_WHITE) gc_val.foreground = backgnd[d] ;
  1295. X!       else                  gc_val.foreground = foregnd[d] ;
  1296. X!     }
  1297. X    gc_val.function = opvals[(int) op] ;
  1298. X    XChangeGC(dpy[d], gc[d], GCForeground | GCFunction, &gc_val) ;
  1299. X    XDrawLine(dpy[d], frame[d], gc[d], x1, y1, x2, y2) ;
  1300. X***************
  1301. X*** 356,362 ****
  1302. X  #else
  1303. X    FD_ZERO(&fullmask) ;
  1304. X  #endif /*NO_43SELECT*/
  1305. X! #endif /*NOSELECT*/
  1306. X  
  1307. X    if (dtype == XTWO)
  1308. X      {
  1309. X--- 369,375 ----
  1310. X  #else
  1311. X    FD_ZERO(&fullmask) ;
  1312. X  #endif /*NO_43SELECT*/
  1313. X! #endif /*!NOSELECT*/
  1314. X  
  1315. X    if (dtype == XTWO)
  1316. X      {
  1317. X***************
  1318. X*** 364,370 ****
  1319. X        init_X(DPY2, XWHITE) ;
  1320. X      }
  1321. X    else init_X(DPY1, dtype) ;
  1322. X-   cmap_loaded = 0 ;
  1323. X    move_delta = 10 ;
  1324. X  
  1325. X    images[(int) BUT_STENCIL] = load_image(button_stencil_image) ;
  1326. X--- 377,382 ----
  1327. X***************
  1328. X*** 394,400 ****
  1329. X    u_char red[OTH_COLORSIZE], green[OTH_COLORSIZE], blue[OTH_COLORSIZE] ;
  1330. X    int d, i, numcolors ;
  1331. X  
  1332. X-   if (cmap_loaded) return ;
  1333. X    d = (int) cur_dpyno ;
  1334. X    iscolor[d] = 0 ;
  1335. X    if (DisplayCells(dpy[d], screen[d]) > 2)
  1336. X--- 406,411 ----
  1337. X***************
  1338. X*** 417,423 ****
  1339. X            FPRINTF(stderr, "%s: cannot allocate colors.\n", progname) ;
  1340. X            exit(1) ;
  1341. X          }
  1342. X-       cmap_loaded = 1 ;
  1343. X      }
  1344. X  }
  1345. X  
  1346. X--- 428,433 ----
  1347. X***************
  1348. X*** 491,499 ****
  1349. X    opvals[(int) RSRC] = GXcopy ;
  1350. X    opvals[(int) RINV] = GXxor ;
  1351. X  
  1352. X!   load_colors() ;
  1353. X!   if (iscolor[d]) reve_icon = load_color_icon(cicon_image) ;
  1354. X!   else            reve_icon = load_image(icon_image) ;
  1355. X  
  1356. X    size.flags = PMinSize | PMaxSize | PPosition | PSize ;
  1357. X    size.x = 0 ;
  1358. X--- 501,509 ----
  1359. X    opvals[(int) RSRC] = GXcopy ;
  1360. X    opvals[(int) RINV] = GXxor ;
  1361. X  
  1362. X!   if (!monochrome) load_colors() ;
  1363. X!   if (iscolor[d]) reve_icon[d] = load_color_icon(cicon_image) ;
  1364. X!   else            reve_icon[d] = load_image(icon_image) ;
  1365. X  
  1366. X    size.flags = PMinSize | PMaxSize | PPosition | PSize ;
  1367. X    size.x = 0 ;
  1368. X***************
  1369. X*** 527,539 ****
  1370. X    protocol_atom[d] = XInternAtom(dpy[d], "WM_PROTOCOLS", False) ;
  1371. X    kill_atom[d]     = XInternAtom(dpy[d], "WM_DELETE_WINDOW", False) ;
  1372. X           
  1373. X!   XSetStandardProperties(dpy[d], frame[d], "reve", NULL, reve_icon,
  1374. X                           argv, argc, &size) ;
  1375. X  
  1376. X    wm_hints.icon_x = ix ;
  1377. X    wm_hints.icon_y = iy ;
  1378. X    wm_hints.input = True ;
  1379. X!   wm_hints.icon_pixmap = reve_icon ;
  1380. X    wm_hints.flags = InputHint | IconPixmapHint ;
  1381. X    if (iconic)
  1382. X      {    
  1383. X--- 537,549 ----
  1384. X    protocol_atom[d] = XInternAtom(dpy[d], "WM_PROTOCOLS", False) ;
  1385. X    kill_atom[d]     = XInternAtom(dpy[d], "WM_DELETE_WINDOW", False) ;
  1386. X           
  1387. X!   XSetStandardProperties(dpy[d], frame[d], "reve", NULL, reve_icon[d],
  1388. X                           argv, argc, &size) ;
  1389. X  
  1390. X    wm_hints.icon_x = ix ;
  1391. X    wm_hints.icon_y = iy ;
  1392. X    wm_hints.input = True ;
  1393. X!   wm_hints.icon_pixmap = reve_icon[d] ;
  1394. X    wm_hints.flags = InputHint | IconPixmapHint ;
  1395. X    if (iconic)
  1396. X      {    
  1397. X***************
  1398. X*** 587,593 ****
  1399. X  #else
  1400. X    FD_SET(xfd[d], &fullmask) ;
  1401. X  #endif /*NO_43SELECT*/
  1402. X! #endif /*NOSELECT*/
  1403. X  
  1404. X    return(dpy) ;
  1405. X  }
  1406. X--- 597,603 ----
  1407. X  #else
  1408. X    FD_SET(xfd[d], &fullmask) ;
  1409. X  #endif /*NO_43SELECT*/
  1410. X! #endif /*!NOSELECT*/
  1411. X  
  1412. X    return(dpy) ;
  1413. X  }
  1414. X***************
  1415. X*** 704,710 ****
  1416. X    for (;;)
  1417. X      {
  1418. X        get_event() ;          /* Get next canvas event. */
  1419. X-       process_event() ;      /* Find out what kind it is. */
  1420. X        handle_event() ;       /* And do the apropriate action. */
  1421. X      }
  1422. X  }
  1423. X--- 714,719 ----
  1424. X***************
  1425. X*** 713,728 ****
  1426. X  Xselect_input()
  1427. X  {
  1428. X    int fd = -1 ;              /* File descriptor with this event. */
  1429. X!   struct timeval tval ;      /* To set checking period. */
  1430. X  
  1431. X-   tval.tv_usec = 0 ;
  1432. X-   tval.tv_sec = 0 ;
  1433. X- 
  1434. X    for (;;)
  1435. X      {
  1436. X!       XSync(dpy[0], 0) ;
  1437. X!       if (dtype == XTWO) XSync(dpy[1], 0) ;
  1438. X! 
  1439. X  #ifdef NOSELECT
  1440. X        fd = 0 ;
  1441. X  #else
  1442. X--- 722,734 ----
  1443. X  Xselect_input()
  1444. X  {
  1445. X    int fd = -1 ;              /* File descriptor with this event. */
  1446. X! /**  static struct timeval tval = { 0, 0 } ; **/
  1447. X!   struct timeval *tval = NULL ;
  1448. X  
  1449. X    for (;;)
  1450. X      {
  1451. X!       XFlush(dpy[(int) DPY1]) ;
  1452. X!       XFlush(dpy[(int) DPY2]) ;
  1453. X  #ifdef NOSELECT
  1454. X        fd = 0 ;
  1455. X  #else
  1456. X***************
  1457. X*** 730,737 ****
  1458. X        readmask = fullmask ;
  1459. X  #ifdef NO_43SELECT
  1460. X        SELECT(32, &readmask, 0, 0, &tval) ;
  1461. X!            if (readmask && (1 << xfd)[0]) fd = 0 ;
  1462. X!       else if (readmask && (1 << xfd)[1]) fd = 1 ;
  1463. X  #else
  1464. X        SELECT(FD_SETSIZE, &readmask, (fd_set *) 0, (fd_set *) 0, &tval) ;
  1465. X             if (FD_ISSET(xfd[0], &readmask)) fd = 0 ;
  1466. X--- 736,743 ----
  1467. X        readmask = fullmask ;
  1468. X  #ifdef NO_43SELECT
  1469. X        SELECT(32, &readmask, 0, 0, &tval) ;
  1470. X!            if (readmask && (1 << xfd[0])) fd = 0 ;
  1471. X!       else if (readmask && (1 << xfd[1])) fd = 1 ;
  1472. X  #else
  1473. X        SELECT(FD_SETSIZE, &readmask, (fd_set *) 0, (fd_set *) 0, &tval) ;
  1474. X             if (FD_ISSET(xfd[0], &readmask)) fd = 0 ;
  1475. X***************
  1476. X*** 741,754 ****
  1477. X   
  1478. X        if (fd >= 0)
  1479. X          {
  1480. X!           cur_dpyno = (enum dpy_type) fd ;
  1481. X!           do
  1482. X              {
  1483. X!               get_event() ;            /* Get next canvas event. */
  1484. X!               process_event() ;        /* Find out what kind it is. */
  1485. X!               handle_event() ;         /* And do appropriate action. */
  1486. X              }             
  1487. X!           while (XPending(dpy[fd])) ;
  1488. X          }
  1489. X      }
  1490. X  }
  1491. X--- 747,767 ----
  1492. X   
  1493. X        if (fd >= 0)
  1494. X          {
  1495. X!           fd = 0 ;
  1496. X!           cur_dpyno = DPY1 ;
  1497. X!           while (XPending(dpy[fd]))
  1498. X              {
  1499. X!               get_event() ;                  /* Get next canvas event. */
  1500. X!               handle_event() ;               /* And do appropriate action. */
  1501. X              }             
  1502. X! 
  1503. X!           fd = 1 ;
  1504. X!           cur_dpyno = DPY2 ;
  1505. X!           while (XPending(dpy[fd]))
  1506. X!             {
  1507. X!               get_event() ;                  /* Get next canvas event. */
  1508. X!               handle_event() ;               /* And do appropriate action. */
  1509. X!             }             
  1510. X          }
  1511. X      }
  1512. X  }
  1513. X
  1514. X------- FILES -------
  1515. X*** /tmp/da28932    Fri Nov  9 10:40:01 1990
  1516. X--- FILES    Sat Nov  3 21:03:34 1990
  1517. X***************
  1518. X*** 33,38 ****
  1519. X--- 33,39 ----
  1520. X  reve.edge1                  - first half of the Reve edge stability table.
  1521. X  reve.edge2                  - second half of the Reve edge stability table.
  1522. X  Makefile.dist               - master Makefile used to build mp on Unix systems.
  1523. X+ Imakefile                   - Imakefile for the X11 version of reve.
  1524. X  
  1525. X  sunview.c                   - Sun SunView graphics routines.
  1526. X  tty.c                       - dumb tty "graphics" routines.
  1527. X
  1528. X------- MANIFEST -------
  1529. X*** /tmp/da28935    Fri Nov  9 10:40:02 1990
  1530. X--- MANIFEST    Sat Nov  3 21:04:35 1990
  1531. X***************
  1532. X*** 32,37 ****
  1533. X--- 32,38 ----
  1534. X  x11.c                                  |    4
  1535. X  xview.c                                |    4
  1536. X  sunview.c                              |    5
  1537. X+ Imakefile                              |    5
  1538. X  images/black.icon                      |    5
  1539. X  images/reve.icon                       |    5
  1540. X  images/reve.color.icon                 |    5
  1541. X
  1542. X------- reve.edge2 -------
  1543. X*** /tmp/da28938    Fri Nov  9 10:40:03 1990
  1544. X--- reve.edge2    Fri Oct 26 12:05:37 1990
  1545. X***************
  1546. X*** 549,555 ****
  1547. X  edges[2188] =     -80 [ -oooooo- ]
  1548. X  edges[2189] =    1304 [ xoooooo- ]
  1549. X  edges[2190] =   -1166 [ o-ooooo- ]
  1550. X! edges[2191] =      34 [ --ooooo- ]
  1551. X  edges[2192] =    1234 [ x-ooooo- ]
  1552. X  edges[2193] =    1434 [ oxooooo- ]
  1553. X  edges[2194] =     -36 [ -xooooo- ]
  1554. X--- 549,555 ----
  1555. X  edges[2188] =     -80 [ -oooooo- ]
  1556. X  edges[2189] =    1304 [ xoooooo- ]
  1557. X  edges[2190] =   -1166 [ o-ooooo- ]
  1558. X! edges[2191] =     100 [ --ooooo- ]
  1559. X  edges[2192] =    1234 [ x-ooooo- ]
  1560. X  edges[2193] =    1434 [ oxooooo- ]
  1561. X  edges[2194] =     -36 [ -xooooo- ]
  1562. X***************
  1563. X*** 1275,1281 ****
  1564. X  edges[2914] =      36 [ -xxxxxo- ]
  1565. X  edges[2915] =    6511 [ xxxxxxo- ]
  1566. X  edges[2916] =   -6441 [ oooooo-- ]
  1567. X! edges[2917] =      34 [ -ooooo-- ]
  1568. X  edges[2918] =    1234 [ xooooo-- ]
  1569. X  edges[2919] =   -1236 [ o-oooo-- ]
  1570. X  edges[2920] =     -36 [ --oooo-- ]
  1571. X--- 1275,1281 ----
  1572. X  edges[2914] =      36 [ -xxxxxo- ]
  1573. X  edges[2915] =    6511 [ xxxxxxo- ]
  1574. X  edges[2916] =   -6441 [ oooooo-- ]
  1575. X! edges[2917] =     100 [ -ooooo-- ]
  1576. X  edges[2918] =    1234 [ xooooo-- ]
  1577. X  edges[2919] =   -1236 [ o-oooo-- ]
  1578. X  edges[2920] =     -36 [ --oooo-- ]
  1579. X
  1580. X
  1581. END_OF_FILE
  1582. if test 48717 -ne `wc -c <'patches01c'`; then
  1583.     echo shar: \"'patches01c'\" unpacked with wrong size!
  1584. fi
  1585. # end of 'patches01c'
  1586. fi
  1587. echo shar: End of archive 3 \(of 4\).
  1588. cp /dev/null ark3isdone
  1589. MISSING=""
  1590. for I in 1 2 3 4 ; do
  1591.     if test ! -f ark${I}isdone ; then
  1592.     MISSING="${MISSING} ${I}"
  1593.     fi
  1594. done
  1595. if test "${MISSING}" = "" ; then
  1596.     echo You have unpacked all 4 archives.
  1597.     rm -f ark[1-9]isdone
  1598. else
  1599.     echo You still need to unpack the following archives:
  1600.     echo "        " ${MISSING}
  1601. fi
  1602. ##  End of shell archive.
  1603. exit 0
  1604.